<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
cfc('core')->checklogin();
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$return=array();
if($_RQ['op']=='get'){
	$member=model('core/member')->detail($_SESSION['uid'],array('credit1','credit2','credit3','credit4','credit5','credit6','mobile','avatar','username','nickname'));
	$item=pdo_get('core_member_bank',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'passed'=>1));
	$item['pcd']=json_decode($item['pcd'],true);
	$item['nickname']=$member['nickname']?:$member['username'];
	$tips='请提交真实姓名，身份证号码！以备顺利完成银行卡绑定！';
	$item['post_data']=$item['post_data']?json_decode($item['post_data'],true):array('timetype'=>'0');
	$return['item']=$item;
	$return['tips']=$tips;
	$nowyear=date('Y');
	$return['years']=array();
	for($i=1998;$i<$nowyear;$i++){
		$return['years'][]=$i;
	}
	$return['years2']=array();
	for($i=$nowyear;$i<2100;$i++){
		$return['years2'][]=$i;
	}
	$return['months']=array('01','02','03','04','05','06','07','08','09',10,11,12);
	$return['days']=array('01','02','03','04','05','06','07','08','09',10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31);
	set_html('title','银行卡绑定');
	exi($return);
}
if($_RQ['op']=='post'){
	$postdata=get_postdata();
	$postdata['ordersn']='SN'.get_ordersn('core_member_bank','sn');
	if(!$postdata['realname'] || !$postdata['bankcard'] || !$postdata['bankname']){
		exi('姓名，银行卡号，所属银行必填！','error');
	}
	model('core/member/cash')->upbank($postdata);
	exi('提交成功！','','goback');
}